﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ConsolidationTool.Common.Entities;
using System.Collections.Generic;
using ConsolidationTool.Common;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using ConsolidationTool.WebParts.ControlTemplates;

using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;

namespace ConsolidationTool.WebParts.Layouts.CReport.Flash
{
    public partial class SID : FSReportBase
    {
        public override ControlTemplates.CommonEntitySelector TopSelector
        {
            get
            {
                return commonEntitySelector as ControlTemplates.CommonEntitySelector;
            }
        }

        public override void BeforLoad()
        {
            if (!IsPostBack)
            {
                InitBaseInfo();
            }
        }
 

        void InitBaseInfo()
        {

            if (!Automatic)
            {
                TopSelector.yearTextBox.Text = Common.BusinessService.GetConfiguration(Constants.Flash_Input_Year);
                TopSelector.monthTextBox.Text = Common.BusinessService.GetConfiguration(Constants.Flash_Input_Month);
            }
            Title_HRM1.Text = TopSelector.yearTextBox.Text + ".01";
            Title_HRM2.Text = TopSelector.yearTextBox.Text + ".02";
            Title_HRM3.Text = TopSelector.yearTextBox.Text + ".03";
            Title_HRM4.Text = TopSelector.yearTextBox.Text + ".04";
            Title_HRM5.Text = TopSelector.yearTextBox.Text + ".05";
            Title_HRM6.Text = TopSelector.yearTextBox.Text + ".06";
            Title_HRM7.Text = TopSelector.yearTextBox.Text + ".07";
            Title_HRM8.Text = TopSelector.yearTextBox.Text + ".08";
            Title_HRM9.Text = TopSelector.yearTextBox.Text + ".09";
            Title_HRM10.Text = TopSelector.yearTextBox.Text + ".10";
            Title_HRM11.Text = TopSelector.yearTextBox.Text + ".11";
            Title_HRM12.Text = TopSelector.yearTextBox.Text + ".12";
        }

        public override void GenerateReport_Click(object sender, EventArgs e)
        {
            Title_HRM1.Text = TopSelector.yearTextBox.Text + ".01";
            Title_HRM2.Text = TopSelector.yearTextBox.Text + ".02";
            Title_HRM3.Text = TopSelector.yearTextBox.Text + ".03";
            Title_HRM4.Text = TopSelector.yearTextBox.Text + ".04";
            Title_HRM5.Text = TopSelector.yearTextBox.Text + ".05";
            Title_HRM6.Text = TopSelector.yearTextBox.Text + ".06";
            Title_HRM7.Text = TopSelector.yearTextBox.Text + ".07";
            Title_HRM8.Text = TopSelector.yearTextBox.Text + ".08";
            Title_HRM9.Text = TopSelector.yearTextBox.Text + ".09";
            Title_HRM10.Text = TopSelector.yearTextBox.Text + ".10";
            Title_HRM11.Text = TopSelector.yearTextBox.Text + ".11";
            Title_HRM12.Text = TopSelector.yearTextBox.Text + ".12";

            //邦定current月数据
            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            
            for (int i = 1; i <= m; i++)
            {
                string strMonth = i.ToString();
                BindLastMonth(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, strMonth);
            }

            DataTable results = new DataTable();
            results = GetListItemsForView(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);
            //results.DefaultView.Sort = "Plant,ProductCode,MaterialCategory,MaterialCode ASC";
            ViewState["ReportRepeater"] = results;
            ReportRepeater.DataSource = results;
            ReportRepeater.DataBind();

            DataTable SPresults = new DataTable();
            SPresults = GetSPListItemsForView(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);
            //results.DefaultView.Sort = "Plant,ProductCode,MaterialCategory,MaterialCode ASC";
            ViewState["SPReportRepeater"] = SPresults;
            SPReportRepeater.DataSource = SPresults;
            SPReportRepeater.DataBind();

            DataTable CPresults = new DataTable();
            CPresults = GetCPListItemsForView(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);
            //results.DefaultView.Sort = "Plant,ProductCode,MaterialCategory,MaterialCode ASC";
            ViewState["CPReportRepeater"] = CPresults;
            CPReportRepeater.DataSource = CPresults;
            CPReportRepeater.DataBind();



            DataTable OSresults = new DataTable();
            OSresults = GetOSListItemsForView(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);
            //results.DefaultView.Sort = "Plant,ProductCode,MaterialCategory,MaterialCode ASC";
            ViewState["OSReportRepeater"] = OSresults;
            OSReportRepeater.DataSource = OSresults;
            OSReportRepeater.DataBind();


            DataTable ISresults = new DataTable();
            ISresults = GetISListItemsForView(TopSelector.lbCoCd.Text, TopSelector.yearTextBox.Text, TopSelector.monthTextBox.Text);
            //results.DefaultView.Sort = "Plant,ProductCode,MaterialCategory,MaterialCode ASC";
            ViewState["ISReportRepeater"] = ISresults;
            ISReportRepeater.DataSource = ISresults;
            ISReportRepeater.DataBind();
        }

        private DataTable GetListItemsForView(string coCd, string year, string month)
        {

            DataTable resultList = new DataTable();
            resultList.Columns.Add("Entity");
            resultList.Columns.Add("RGC");
            resultList.Columns.Add("QTY01");
            resultList.Columns.Add("QTY02");
            resultList.Columns.Add("QTY03");
            resultList.Columns.Add("QTY04");
            resultList.Columns.Add("QTY05");
            resultList.Columns.Add("QTY06");
            resultList.Columns.Add("QTY07");
            resultList.Columns.Add("QTY08");
            resultList.Columns.Add("QTY09");
            resultList.Columns.Add("QTY10");
            resultList.Columns.Add("QTY11");
            resultList.Columns.Add("QTY12");
            resultList.Columns.Add("QTY13");
            resultList.Columns.Add("QTY14");
            resultList.Columns.Add("QTY15");
            resultList.Columns.Add("QTY16");
            resultList.Columns.Add("QTY17");
            resultList.Columns.Add("QTY18");
            resultList.Columns.Add("QTY19");
            resultList.Columns.Add("QTY20");
            resultList.Columns.Add("QTY21");
            resultList.Columns.Add("QTY22");
            resultList.Columns.Add("QTY23");
            resultList.Columns.Add("QTY24");
            resultList.Columns.Add("QTY25");
            resultList.Columns.Add("QTY26");
            resultList.Columns.Add("QTY27");
            resultList.Columns.Add("QTY28");
            resultList.Columns.Add("QTY29");
            resultList.Columns.Add("QTY30");
            resultList.Columns.Add("QTY31");
            resultList.Columns.Add("QTY32");
            resultList.Columns.Add("QTY33");
            resultList.Columns.Add("QTY34");
            resultList.Columns.Add("QTY35");
            resultList.Columns.Add("QTY36");
            resultList.Columns.Add("QTY37");
            resultList.Columns.Add("QTY38");
            resultList.Columns.Add("QTY39");
            resultList.Columns.Add("QTY40");
            resultList.Columns.Add("QTY41");
            resultList.Columns.Add("QTY42");
            resultList.Columns.Add("QTY43");
            resultList.Columns.Add("QTY44");
            resultList.Columns.Add("QTY45");
            resultList.Columns.Add("QTY46");
            resultList.Columns.Add("QTY47");
            resultList.Columns.Add("QTY48");

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            for (int i = 1; i <= m; i++)
            {
                string mo = Convert.ToString(i);
                SPListItemCollection items = Common.BusinessService.GetSubItems(coCd, year, mo, "Sub Sales Interco Declaration", "SI01010201");

                if (items != null)
                {
                    for (int j = 1; j <= items.Count; j++)
                    {
                        if (resultList.Rows.Count > 0)
                        {
                            int n = 0;
                            for (int k = 1; k <= resultList.Rows.Count; k++)
                            {
                                if (items[j - 1]["CoName"].ToString() == resultList.Rows[k - 1]["Entity"].ToString())
                                {
                                    n = k;
                                }
                            }
                            if (n != 0)
                            {
                                switch (mo)
                                {
                                    case "1":
                                        resultList.Rows[n - 1]["QTY01"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY02"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY03"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY04"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "2":
                                        resultList.Rows[n - 1]["QTY05"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY06"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY07"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY08"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "3":
                                        resultList.Rows[n - 1]["QTY09"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY10"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY11"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY12"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "4":
                                        resultList.Rows[n - 1]["QTY13"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY14"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY15"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY16"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "5":
                                        resultList.Rows[n - 1]["QTY17"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY18"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY19"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY20"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "6":
                                        resultList.Rows[n - 1]["QTY21"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY22"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY23"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY24"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "7":
                                        resultList.Rows[n - 1]["QTY25"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY26"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY27"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY28"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "8":
                                        resultList.Rows[n - 1]["QTY29"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY30"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY31"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY32"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "9":
                                        resultList.Rows[n - 1]["QTY33"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY34"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY35"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY36"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "10":
                                        resultList.Rows[n - 1]["QTY37"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY38"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY39"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY40"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "11":
                                        resultList.Rows[n - 1]["QTY41"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY42"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY43"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY44"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "12":
                                        resultList.Rows[n - 1]["QTY45"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY46"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY47"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        resultList.Rows[n - 1]["QTY48"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;

                                    default:
                                        break;
                                }

                                resultList.AcceptChanges();
                            }
                            else
                            {
                                DataRow report = resultList.NewRow();
                                report["Entity"] = items[j - 1]["CoName"].ToString();
                                report["RGC"] = "";
                                switch (mo)
                                {
                                    case "1":
                                        report["QTY01"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY02"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY03"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY04"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "2":
                                        report["QTY05"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY06"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY07"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY08"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "3":
                                        report["QTY09"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY10"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY11"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY12"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "4":
                                        report["QTY13"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY14"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY15"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY16"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "5":
                                        report["QTY17"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY18"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY19"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY20"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "6":
                                        report["QTY21"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY22"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY23"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY24"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "7":
                                        report["QTY25"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY26"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY27"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY28"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "8":
                                        report["QTY29"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY30"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY31"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY32"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "9":
                                        report["QTY33"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY34"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY35"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY36"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "10":
                                        report["QTY37"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY38"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY39"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY40"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "11":
                                        report["QTY41"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY42"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY43"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY44"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    case "12":
                                        report["QTY45"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                        report["QTY46"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                        report["QTY47"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                        report["QTY48"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                        break;
                                    default:
                                        break;
                                }

                                resultList.Rows.Add(report);
                                resultList.AcceptChanges();
                            }
                        }
                        else
                        {
                            DataRow report = resultList.NewRow();
                            report["Entity"] = items[j - 1]["CoName"].ToString();
                            report["RGC"] = "";
                            switch (mo)
                            {
                                case "1":
                                    report["QTY01"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY02"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY03"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY04"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "2":
                                    report["QTY05"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY06"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY07"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY08"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "3":
                                    report["QTY09"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY10"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY11"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY12"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "4":
                                    report["QTY13"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY14"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY15"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY16"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "5":
                                    report["QTY17"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY18"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY19"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY20"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "6":
                                    report["QTY21"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY22"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY23"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY24"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "7":
                                    report["QTY25"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY26"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY27"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY28"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "8":
                                    report["QTY29"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY30"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY31"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY32"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "9":
                                    report["QTY33"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY34"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY35"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY36"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "10":
                                    report["QTY37"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY38"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY39"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY40"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "11":
                                    report["QTY41"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY42"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY43"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY44"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                case "12":
                                    report["QTY45"] = items[j - 1]["CM_QTY_SI01010201"].ToString();
                                    report["QTY46"] = items[j - 1]["CM_IC_SI01010201"].ToString();
                                    report["QTY47"] = items[j - 1]["CM_IA_SI01010201"].ToString();
                                    report["QTY48"] = items[j - 1]["CM_BA_SI01010201"].ToString();
                                    break;
                                default:
                                    break;
                            }
                            

                            resultList.Rows.Add(report);
                            resultList.AcceptChanges();
                        }
                    }
                }
            } 

            return resultList;
        }

        private DataTable GetSPListItemsForView(string coCd, string year, string month)
        {

            DataTable resultList = new DataTable();
            resultList.Columns.Add("SPEntity");
            resultList.Columns.Add("SPRGC");
            resultList.Columns.Add("SPQTY01");
            resultList.Columns.Add("SPQTY02");
            resultList.Columns.Add("SPQTY03");
            resultList.Columns.Add("SPQTY04");
            resultList.Columns.Add("SPQTY05");
            resultList.Columns.Add("SPQTY06");
            resultList.Columns.Add("SPQTY07");
            resultList.Columns.Add("SPQTY08");
            resultList.Columns.Add("SPQTY09");
            resultList.Columns.Add("SPQTY10");
            resultList.Columns.Add("SPQTY11");
            resultList.Columns.Add("SPQTY12");
            resultList.Columns.Add("SPQTY13");
            resultList.Columns.Add("SPQTY14");
            resultList.Columns.Add("SPQTY15");
            resultList.Columns.Add("SPQTY16");
            resultList.Columns.Add("SPQTY17");
            resultList.Columns.Add("SPQTY18");
            resultList.Columns.Add("SPQTY19");
            resultList.Columns.Add("SPQTY20");
            resultList.Columns.Add("SPQTY21");
            resultList.Columns.Add("SPQTY22");
            resultList.Columns.Add("SPQTY23");
            resultList.Columns.Add("SPQTY24");
            resultList.Columns.Add("SPQTY25");
            resultList.Columns.Add("SPQTY26");
            resultList.Columns.Add("SPQTY27");
            resultList.Columns.Add("SPQTY28");
            resultList.Columns.Add("SPQTY29");
            resultList.Columns.Add("SPQTY30");
            resultList.Columns.Add("SPQTY31");
            resultList.Columns.Add("SPQTY32");
            resultList.Columns.Add("SPQTY33");
            resultList.Columns.Add("SPQTY34");
            resultList.Columns.Add("SPQTY35");
            resultList.Columns.Add("SPQTY36");
            resultList.Columns.Add("SPQTY37");
            resultList.Columns.Add("SPQTY38");
            resultList.Columns.Add("SPQTY39");
            resultList.Columns.Add("SPQTY40");
            resultList.Columns.Add("SPQTY41");
            resultList.Columns.Add("SPQTY42");
            resultList.Columns.Add("SPQTY43");
            resultList.Columns.Add("SPQTY44");
            resultList.Columns.Add("SPQTY45");
            resultList.Columns.Add("SPQTY46");
            resultList.Columns.Add("SPQTY47");
            resultList.Columns.Add("SPQTY48");

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            for (int i = 1; i <= m; i++)
            {
                string mo = Convert.ToString(i);
                SPListItemCollection items = Common.BusinessService.GetSubItems(coCd, year, mo, "Sub Sales Interco Declaration", "SI01030201");

                if (items != null)
                {
                    for (int j = 1; j <= items.Count; j++)
                    {
                        if (resultList.Rows.Count > 0)
                        {
                            int n = 0;
                            for (int k = 1; k <= resultList.Rows.Count; k++)
                            {
                                if (items[j - 1]["CoName"].ToString() == resultList.Rows[k - 1]["SPEntity"].ToString())
                                {
                                    n = k;
                                }
                            }
                            if (n != 0)
                            {
                                switch (mo)
                                {
                                    case "1":
                                        resultList.Rows[n - 1]["SPQTY01"] = "";
                                        resultList.Rows[n - 1]["SPQTY02"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY03"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY04"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "2":
                                        resultList.Rows[n - 1]["SPQTY05"] = "";
                                        resultList.Rows[n - 1]["SPQTY06"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY07"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY08"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "3":
                                        resultList.Rows[n - 1]["SPQTY09"] = "";
                                        resultList.Rows[n - 1]["SPQTY10"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY11"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY12"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "4":
                                        resultList.Rows[n - 1]["SPQTY13"] = "";
                                        resultList.Rows[n - 1]["SPQTY14"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY15"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY16"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "5":
                                        resultList.Rows[n - 1]["SPQTY17"] = "";
                                        resultList.Rows[n - 1]["SPQTY18"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY19"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY20"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "6":
                                        resultList.Rows[n - 1]["SPQTY21"] = "";
                                        resultList.Rows[n - 1]["SPQTY22"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY23"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY24"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "7":
                                        resultList.Rows[n - 1]["SPQTY25"] = "";
                                        resultList.Rows[n - 1]["SPQTY26"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY27"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY28"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "8":
                                        resultList.Rows[n - 1]["SPQTY29"] = "";
                                        resultList.Rows[n - 1]["SPQTY30"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY31"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY32"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "9":
                                        resultList.Rows[n - 1]["SPQTY33"] = "";
                                        resultList.Rows[n - 1]["SPQTY34"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY35"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY36"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "10":
                                        resultList.Rows[n - 1]["SPQTY37"] = "";
                                        resultList.Rows[n - 1]["SPQTY38"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY39"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY40"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "11":
                                        resultList.Rows[n - 1]["SPQTY41"] = "";
                                        resultList.Rows[n - 1]["SPQTY42"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY43"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY44"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "12":
                                        resultList.Rows[n - 1]["SPQTY45"] = "";
                                        resultList.Rows[n - 1]["SPQTY46"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY47"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        resultList.Rows[n - 1]["SPQTY48"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;

                                    default:
                                        break;
                                }

                                resultList.AcceptChanges();
                            }
                            else
                            {
                                DataRow report = resultList.NewRow();
                                report["SPEntity"] = items[j - 1]["CoName"].ToString();
                                report["SPRGC"] = "";
                                switch (mo)
                                {
                                    case "1":
                                        report["SPQTY01"] = "";
                                        report["SPQTY02"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY03"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY04"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "2":
                                        report["SPQTY05"] = "";
                                        report["SPQTY06"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY07"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY08"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "3":
                                        report["SPQTY09"] = "";
                                        report["SPQTY10"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY11"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY12"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "4":
                                        report["SPQTY13"] = "";
                                        report["SPQTY14"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY15"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY16"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "5":
                                        report["SPQTY17"] = "";
                                        report["SPQTY18"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY19"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY20"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "6":
                                        report["SPQTY21"] = "";
                                        report["SPQTY22"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY23"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY24"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "7":
                                        report["SPQTY25"] = "";
                                        report["SPQTY26"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY27"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY28"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "8":
                                        report["SPQTY29"] = "";
                                        report["SPQTY30"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY31"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY32"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "9":
                                        report["SPQTY33"] = "";
                                        report["SPQTY34"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY35"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY36"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "10":
                                        report["SPQTY37"] = "";
                                        report["SPQTY38"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY39"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY40"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "11":
                                        report["SPQTY41"] = "";
                                        report["SPQTY42"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY43"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY44"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    case "12":
                                        report["SPQTY45"] = "";
                                        report["SPQTY46"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                        report["SPQTY47"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                        report["SPQTY48"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                        break;
                                    default:
                                        break;
                                }

                                resultList.Rows.Add(report);
                                resultList.AcceptChanges();
                            }
                        }
                        else
                        {
                            DataRow report = resultList.NewRow();
                            report["SPEntity"] = items[j - 1]["CoName"].ToString();
                            report["SPRGC"] = "";
                            switch (mo)
                            {
                                case "1":
                                    report["SPQTY01"] = "";
                                    report["SPQTY02"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY03"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY04"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "2":
                                    report["SPQTY05"] = "";
                                    report["SPQTY06"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY07"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY08"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "3":
                                    report["SPQTY09"] = "";
                                    report["SPQTY10"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY11"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY12"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "4":
                                    report["SPQTY13"] = "";
                                    report["SPQTY14"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY15"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY16"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "5":
                                    report["SPQTY17"] = "";
                                    report["SPQTY18"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY19"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY20"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "6":
                                    report["SPQTY21"] = "";
                                    report["SPQTY22"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY23"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY24"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "7":
                                    report["SPQTY25"] = "";
                                    report["SPQTY26"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY27"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY28"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "8":
                                    report["SPQTY29"] = "";
                                    report["SPQTY30"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY31"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY32"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "9":
                                    report["SPQTY33"] = "";
                                    report["SPQTY34"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY35"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY36"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "10":
                                    report["SPQTY37"] = "";
                                    report["SPQTY38"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY39"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY40"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "11":
                                    report["SPQTY41"] = "";
                                    report["SPQTY42"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY43"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY44"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                case "12":
                                    report["SPQTY45"] = "";
                                    report["SPQTY46"] = items[j - 1]["CM_IC_SI01030201"].ToString();
                                    report["SPQTY47"] = items[j - 1]["CM_IA_SI01030201"].ToString();
                                    report["SPQTY48"] = items[j - 1]["CM_BA_SI01030201"].ToString();
                                    break;
                                default:
                                    break;
                            }


                            resultList.Rows.Add(report);
                            resultList.AcceptChanges();
                        }
                    }
                }
            }

            return resultList;
        }

        private DataTable GetCPListItemsForView(string coCd, string year, string month)
        {

            DataTable resultList = new DataTable();
            resultList.Columns.Add("CPEntity");
            resultList.Columns.Add("CPRGC");
            resultList.Columns.Add("CPQTY01");
            resultList.Columns.Add("CPQTY02");
            resultList.Columns.Add("CPQTY03");
            resultList.Columns.Add("CPQTY04");
            resultList.Columns.Add("CPQTY05");
            resultList.Columns.Add("CPQTY06");
            resultList.Columns.Add("CPQTY07");
            resultList.Columns.Add("CPQTY08");
            resultList.Columns.Add("CPQTY09");
            resultList.Columns.Add("CPQTY10");
            resultList.Columns.Add("CPQTY11");
            resultList.Columns.Add("CPQTY12");
            resultList.Columns.Add("CPQTY13");
            resultList.Columns.Add("CPQTY14");
            resultList.Columns.Add("CPQTY15");
            resultList.Columns.Add("CPQTY16");
            resultList.Columns.Add("CPQTY17");
            resultList.Columns.Add("CPQTY18");
            resultList.Columns.Add("CPQTY19");
            resultList.Columns.Add("CPQTY20");
            resultList.Columns.Add("CPQTY21");
            resultList.Columns.Add("CPQTY22");
            resultList.Columns.Add("CPQTY23");
            resultList.Columns.Add("CPQTY24");
            resultList.Columns.Add("CPQTY25");
            resultList.Columns.Add("CPQTY26");
            resultList.Columns.Add("CPQTY27");
            resultList.Columns.Add("CPQTY28");
            resultList.Columns.Add("CPQTY29");
            resultList.Columns.Add("CPQTY30");
            resultList.Columns.Add("CPQTY31");
            resultList.Columns.Add("CPQTY32");
            resultList.Columns.Add("CPQTY33");
            resultList.Columns.Add("CPQTY34");
            resultList.Columns.Add("CPQTY35");
            resultList.Columns.Add("CPQTY36");
            resultList.Columns.Add("CPQTY37");
            resultList.Columns.Add("CPQTY38");
            resultList.Columns.Add("CPQTY39");
            resultList.Columns.Add("CPQTY40");
            resultList.Columns.Add("CPQTY41");
            resultList.Columns.Add("CPQTY42");
            resultList.Columns.Add("CPQTY43");
            resultList.Columns.Add("CPQTY44");
            resultList.Columns.Add("CPQTY45");
            resultList.Columns.Add("CPQTY46");
            resultList.Columns.Add("CPQTY47");
            resultList.Columns.Add("CPQTY48");

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            for (int i = 1; i <= m; i++)
            {
                string mo = Convert.ToString(i);
                SPListItemCollection items = Common.BusinessService.GetSubItems(coCd, year, mo, "Sub Sales Interco Declaration", "SI01040101");

                if (items != null)
                {
                    for (int j = 1; j <= items.Count; j++)
                    {
                        if (resultList.Rows.Count > 0)
                        {
                            int n = 0;
                            for (int k = 1; k <= resultList.Rows.Count; k++)
                            {
                                if (items[j - 1]["CoName"].ToString() == resultList.Rows[k - 1]["CPEntity"].ToString())
                                {
                                    n = k;
                                }
                            }
                            if (n != 0)
                            {
                                switch (mo)
                                {
                                    case "1":
                                        resultList.Rows[n - 1]["CPQTY01"] = "";
                                        resultList.Rows[n - 1]["CPQTY02"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY03"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY04"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "2":
                                        resultList.Rows[n - 1]["CPQTY05"] = "";
                                        resultList.Rows[n - 1]["CPQTY06"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY07"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY08"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "3":
                                        resultList.Rows[n - 1]["CPQTY09"] = "";
                                        resultList.Rows[n - 1]["CPQTY10"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY11"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY12"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "4":
                                        resultList.Rows[n - 1]["CPQTY13"] = "";
                                        resultList.Rows[n - 1]["CPQTY14"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY15"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY16"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "5":
                                        resultList.Rows[n - 1]["CPQTY17"] = "";
                                        resultList.Rows[n - 1]["CPQTY18"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY19"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY20"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "6":
                                        resultList.Rows[n - 1]["CPQTY21"] = "";
                                        resultList.Rows[n - 1]["CPQTY22"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY23"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY24"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "7":
                                        resultList.Rows[n - 1]["CPQTY25"] = "";
                                        resultList.Rows[n - 1]["CPQTY26"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY27"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY28"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "8":
                                        resultList.Rows[n - 1]["CPQTY29"] = "";
                                        resultList.Rows[n - 1]["CPQTY30"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY31"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY32"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "9":
                                        resultList.Rows[n - 1]["CPQTY33"] = "";
                                        resultList.Rows[n - 1]["CPQTY34"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY35"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY36"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "10":
                                        resultList.Rows[n - 1]["CPQTY37"] = "";
                                        resultList.Rows[n - 1]["CPQTY38"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY39"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY40"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "11":
                                        resultList.Rows[n - 1]["CPQTY41"] = "";
                                        resultList.Rows[n - 1]["CPQTY42"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY43"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY44"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "12":
                                        resultList.Rows[n - 1]["CPQTY45"] = "";
                                        resultList.Rows[n - 1]["CPQTY46"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY47"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        resultList.Rows[n - 1]["CPQTY48"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;

                                    default:
                                        break;
                                }

                                resultList.AcceptChanges();
                            }
                            else
                            {
                                DataRow report = resultList.NewRow();
                                report["CPEntity"] = items[j - 1]["CoName"].ToString();
                                report["CPRGC"] = "";
                                switch (mo)
                                {
                                    case "1":
                                        report["CPQTY01"] = "";
                                        report["CPQTY02"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY03"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY04"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "2":
                                        report["CPQTY05"] = "";
                                        report["CPQTY06"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY07"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY08"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "3":
                                        report["CPQTY09"] = "";
                                        report["CPQTY10"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY11"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY12"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "4":
                                        report["CPQTY13"] = "";
                                        report["CPQTY14"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY15"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY16"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "5":
                                        report["CPQTY17"] = "";
                                        report["CPQTY18"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY19"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY20"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "6":
                                        report["CPQTY21"] = "";
                                        report["CPQTY22"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY23"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY24"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "7":
                                        report["CPQTY25"] = "";
                                        report["CPQTY26"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY27"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY28"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "8":
                                        report["CPQTY29"] = "";
                                        report["CPQTY30"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY31"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY32"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "9":
                                        report["CPQTY33"] = "";
                                        report["CPQTY34"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY35"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY36"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "10":
                                        report["CPQTY37"] = "";
                                        report["CPQTY38"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY39"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY40"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "11":
                                        report["CPQTY41"] = "";
                                        report["CPQTY42"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY43"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY44"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    case "12":
                                        report["CPQTY45"] = "";
                                        report["CPQTY46"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                        report["CPQTY47"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                        report["CPQTY48"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                        break;
                                    default:
                                        break;
                                }

                                resultList.Rows.Add(report);
                                resultList.AcceptChanges();
                            }
                        }
                        else
                        {
                            DataRow report = resultList.NewRow();
                            report["CPEntity"] = items[j - 1]["CoName"].ToString();
                            report["CPRGC"] = "";
                            switch (mo)
                            {
                                case "1":
                                    report["CPQTY01"] = "";
                                    report["CPQTY02"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY03"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY04"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "2":
                                    report["CPQTY05"] = "";
                                    report["CPQTY06"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY07"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY08"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "3":
                                    report["CPQTY09"] = "";
                                    report["CPQTY10"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY11"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY12"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "4":
                                    report["CPQTY13"] = "";
                                    report["CPQTY14"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY15"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY16"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "5":
                                    report["CPQTY17"] = "";
                                    report["CPQTY18"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY19"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY20"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "6":
                                    report["CPQTY21"] = "";
                                    report["CPQTY22"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY23"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY24"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "7":
                                    report["CPQTY25"] = "";
                                    report["CPQTY26"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY27"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY28"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "8":
                                    report["CPQTY29"] = "";
                                    report["CPQTY30"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY31"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY32"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "9":
                                    report["CPQTY33"] = "";
                                    report["CPQTY34"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY35"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY36"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "10":
                                    report["CPQTY37"] = "";
                                    report["CPQTY38"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY39"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY40"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "11":
                                    report["CPQTY41"] = "";
                                    report["CPQTY42"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY43"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY44"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                case "12":
                                    report["CPQTY45"] = "";
                                    report["CPQTY46"] = items[j - 1]["CM_IC_SI01040101"].ToString();
                                    report["CPQTY47"] = items[j - 1]["CM_IA_SI01040101"].ToString();
                                    report["CPQTY48"] = items[j - 1]["CM_BA_SI01040101"].ToString();
                                    break;
                                default:
                                    break;
                            }


                            resultList.Rows.Add(report);
                            resultList.AcceptChanges();
                        }
                    }
                }
            }

            return resultList;
        }

        private DataTable GetOSListItemsForView(string coCd, string year, string month)
        {

            DataTable resultList = new DataTable();
            resultList.Columns.Add("SPEntity");
            resultList.Columns.Add("SPRGC");
            resultList.Columns.Add("SPQTY01");
            resultList.Columns.Add("SPQTY02");
            resultList.Columns.Add("SPQTY03");
            resultList.Columns.Add("SPQTY04");
            resultList.Columns.Add("SPQTY05");
            resultList.Columns.Add("SPQTY06");
            resultList.Columns.Add("SPQTY07");
            resultList.Columns.Add("SPQTY08");
            resultList.Columns.Add("SPQTY09");
            resultList.Columns.Add("SPQTY10");
            resultList.Columns.Add("SPQTY11");
            resultList.Columns.Add("SPQTY12");
            resultList.Columns.Add("SPQTY13");
            resultList.Columns.Add("SPQTY14");
            resultList.Columns.Add("SPQTY15");
            resultList.Columns.Add("SPQTY16");
            resultList.Columns.Add("SPQTY17");
            resultList.Columns.Add("SPQTY18");
            resultList.Columns.Add("SPQTY19");
            resultList.Columns.Add("SPQTY20");
            resultList.Columns.Add("SPQTY21");
            resultList.Columns.Add("SPQTY22");
            resultList.Columns.Add("SPQTY23");
            resultList.Columns.Add("SPQTY24");
            resultList.Columns.Add("SPQTY25");
            resultList.Columns.Add("SPQTY26");
            resultList.Columns.Add("SPQTY27");
            resultList.Columns.Add("SPQTY28");
            resultList.Columns.Add("SPQTY29");
            resultList.Columns.Add("SPQTY30");
            resultList.Columns.Add("SPQTY31");
            resultList.Columns.Add("SPQTY32");
            resultList.Columns.Add("SPQTY33");
            resultList.Columns.Add("SPQTY34");
            resultList.Columns.Add("SPQTY35");
            resultList.Columns.Add("SPQTY36");
            resultList.Columns.Add("SPQTY37");
            resultList.Columns.Add("SPQTY38");
            resultList.Columns.Add("SPQTY39");
            resultList.Columns.Add("SPQTY40");
            resultList.Columns.Add("SPQTY41");
            resultList.Columns.Add("SPQTY42");
            resultList.Columns.Add("SPQTY43");
            resultList.Columns.Add("SPQTY44");
            resultList.Columns.Add("SPQTY45");
            resultList.Columns.Add("SPQTY46");
            resultList.Columns.Add("SPQTY47");
            resultList.Columns.Add("SPQTY48");

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            for (int i = 1; i <= m; i++)
            {
                string mo = Convert.ToString(i);
                SPListItemCollection items = Common.BusinessService.GetSubItems(coCd, year, mo, "Sub Sales Interco Declaration", "SI01050201");

                if (items != null)
                {
                    for (int j = 1; j <= items.Count; j++)
                    {
                        if (resultList.Rows.Count > 0)
                        {
                            int n = 0;
                            for (int k = 1; k <= resultList.Rows.Count; k++)
                            {
                                if (items[j - 1]["CoName"].ToString() == resultList.Rows[k - 1]["SPEntity"].ToString())
                                {
                                    n = k;
                                }
                            }
                            if (n != 0)
                            {
                                switch (mo)
                                {
                                    case "1":
                                        resultList.Rows[n - 1]["SPQTY01"] = "";
                                        resultList.Rows[n - 1]["SPQTY02"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "2":
                                        resultList.Rows[n - 1]["SPQTY05"] = "";
                                        resultList.Rows[n - 1]["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "3":
                                        resultList.Rows[n - 1]["SPQTY09"] = "";
                                        resultList.Rows[n - 1]["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "4":
                                        resultList.Rows[n - 1]["SPQTY13"] = "";
                                        resultList.Rows[n - 1]["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "5":
                                        resultList.Rows[n - 1]["SPQTY17"] = "";
                                        resultList.Rows[n - 1]["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "6":
                                        resultList.Rows[n - 1]["SPQTY21"] = "";
                                        resultList.Rows[n - 1]["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "7":
                                        resultList.Rows[n - 1]["SPQTY25"] = "";
                                        resultList.Rows[n - 1]["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "8":
                                        resultList.Rows[n - 1]["SPQTY29"] = "";
                                        resultList.Rows[n - 1]["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "9":
                                        resultList.Rows[n - 1]["SPQTY33"] = "";
                                        resultList.Rows[n - 1]["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "10":
                                        resultList.Rows[n - 1]["SPQTY37"] = "";
                                        resultList.Rows[n - 1]["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "11":
                                        resultList.Rows[n - 1]["SPQTY41"] = "";
                                        resultList.Rows[n - 1]["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "12":
                                        resultList.Rows[n - 1]["SPQTY45"] = "";
                                        resultList.Rows[n - 1]["SPQTY46"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        resultList.Rows[n - 1]["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;

                                    default:
                                        break;
                                }

                                resultList.AcceptChanges();
                            }
                            else
                            {
                                DataRow report = resultList.NewRow();
                                report["SPEntity"] = items[j - 1]["CoName"].ToString();
                                report["SPRGC"] = "";
                                switch (mo)
                                {
                                    case "1":
                                        report["SPQTY01"] = "";
                                        report["SPQTY02"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "2":
                                        report["SPQTY05"] = "";
                                        report["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "3":
                                        report["SPQTY09"] = "";
                                        report["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "4":
                                        report["SPQTY13"] = "";
                                        report["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "5":
                                        report["SPQTY17"] = "";
                                        report["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "6":
                                        report["SPQTY21"] = "";
                                        report["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "7":
                                        report["SPQTY25"] = "";
                                        report["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "8":
                                        report["SPQTY29"] = "";
                                        report["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "9":
                                        report["SPQTY33"] = "";
                                        report["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "10":
                                        report["SPQTY37"] = "";
                                        report["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "11":
                                        report["SPQTY41"] = "";
                                        report["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    case "12":
                                        report["SPQTY45"] = "";
                                        report["SPQTY46"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                        report["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                        report["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                        break;
                                    default:
                                        break;
                                }

                                resultList.Rows.Add(report);
                                resultList.AcceptChanges();
                            }
                        }
                        else
                        {
                            DataRow report = resultList.NewRow();
                            report["SPEntity"] = items[j - 1]["CoName"].ToString();
                            report["SPRGC"] = "";
                            switch (mo)
                            {
                                case "1":
                                    report["SPQTY01"] = "";
                                    report["SPQTY02"] =Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "2":
                                    report["SPQTY05"] = "";
                                    report["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "3":
                                    report["SPQTY09"] = "";
                                    report["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "4":
                                    report["SPQTY13"] = "";
                                    report["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "5":
                                    report["SPQTY17"] = "";
                                    report["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "6":
                                    report["SPQTY21"] = "";
                                    report["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "7":
                                    report["SPQTY25"] = "";
                                    report["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "8":
                                    report["SPQTY29"] = "";
                                    report["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "9":
                                    report["SPQTY33"] = "";
                                    report["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "10":
                                    report["SPQTY37"] = "";
                                    report["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "11":
                                    report["SPQTY41"] = "";
                                    report["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                case "12":
                                    report["SPQTY45"] = "";
                                    report["SPQTY46"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01050201_x0020_");
                                    report["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01050201_x0020_");
                                    report["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01050201_x0020_");
                                    break;
                                default:
                                    break;
                            }


                            resultList.Rows.Add(report);
                            resultList.AcceptChanges();
                        }
                    }
                }
            }

            return resultList;
        }

        private DataTable GetISListItemsForView(string coCd, string year, string month)
        {

            DataTable resultList = new DataTable();
            resultList.Columns.Add("SPEntity");
            resultList.Columns.Add("SPRGC");
            resultList.Columns.Add("SPQTY01");
            resultList.Columns.Add("SPQTY02");
            resultList.Columns.Add("SPQTY03");
            resultList.Columns.Add("SPQTY04");
            resultList.Columns.Add("SPQTY05");
            resultList.Columns.Add("SPQTY06");
            resultList.Columns.Add("SPQTY07");
            resultList.Columns.Add("SPQTY08");
            resultList.Columns.Add("SPQTY09");
            resultList.Columns.Add("SPQTY10");
            resultList.Columns.Add("SPQTY11");
            resultList.Columns.Add("SPQTY12");
            resultList.Columns.Add("SPQTY13");
            resultList.Columns.Add("SPQTY14");
            resultList.Columns.Add("SPQTY15");
            resultList.Columns.Add("SPQTY16");
            resultList.Columns.Add("SPQTY17");
            resultList.Columns.Add("SPQTY18");
            resultList.Columns.Add("SPQTY19");
            resultList.Columns.Add("SPQTY20");
            resultList.Columns.Add("SPQTY21");
            resultList.Columns.Add("SPQTY22");
            resultList.Columns.Add("SPQTY23");
            resultList.Columns.Add("SPQTY24");
            resultList.Columns.Add("SPQTY25");
            resultList.Columns.Add("SPQTY26");
            resultList.Columns.Add("SPQTY27");
            resultList.Columns.Add("SPQTY28");
            resultList.Columns.Add("SPQTY29");
            resultList.Columns.Add("SPQTY30");
            resultList.Columns.Add("SPQTY31");
            resultList.Columns.Add("SPQTY32");
            resultList.Columns.Add("SPQTY33");
            resultList.Columns.Add("SPQTY34");
            resultList.Columns.Add("SPQTY35");
            resultList.Columns.Add("SPQTY36");
            resultList.Columns.Add("SPQTY37");
            resultList.Columns.Add("SPQTY38");
            resultList.Columns.Add("SPQTY39");
            resultList.Columns.Add("SPQTY40");
            resultList.Columns.Add("SPQTY41");
            resultList.Columns.Add("SPQTY42");
            resultList.Columns.Add("SPQTY43");
            resultList.Columns.Add("SPQTY44");
            resultList.Columns.Add("SPQTY45");
            resultList.Columns.Add("SPQTY46");
            resultList.Columns.Add("SPQTY47");
            resultList.Columns.Add("SPQTY48");

            int m = Convert.ToInt32(TopSelector.monthTextBox.Text);

            for (int i = 1; i <= m; i++)
            {
                string mo = Convert.ToString(i);
                SPListItemCollection items = Common.BusinessService.GetSubItems(coCd, year, mo, "Sub Sales Interco Declaration", "SI01060201");

                if (items != null)
                {
                    for (int j = 1; j <= items.Count; j++)
                    {
                        if (resultList.Rows.Count > 0)
                        {
                            int n = 0;
                            for (int k = 1; k <= resultList.Rows.Count; k++)
                            {
                                if (items[j - 1]["CoName"].ToString() == resultList.Rows[k - 1]["SPEntity"].ToString())
                                {
                                    n = k;
                                }
                            }
                            if (n != 0)
                            {
                                switch (mo)
                                {
                                    case "1":
                                        resultList.Rows[n - 1]["SPQTY01"] = "";
                                        resultList.Rows[n - 1]["SPQTY02"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "2":
                                        resultList.Rows[n - 1]["SPQTY05"] = "";
                                        resultList.Rows[n - 1]["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "3":
                                        resultList.Rows[n - 1]["SPQTY09"] = "";
                                        resultList.Rows[n - 1]["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "4":
                                        resultList.Rows[n - 1]["SPQTY13"] = "";
                                        resultList.Rows[n - 1]["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "5":
                                        resultList.Rows[n - 1]["SPQTY17"] = "";
                                        resultList.Rows[n - 1]["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "6":
                                        resultList.Rows[n - 1]["SPQTY21"] = "";
                                        resultList.Rows[n - 1]["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "7":
                                        resultList.Rows[n - 1]["SPQTY25"] = "";
                                        resultList.Rows[n - 1]["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "8":
                                        resultList.Rows[n - 1]["SPQTY29"] = "";
                                        resultList.Rows[n - 1]["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "9":
                                        resultList.Rows[n - 1]["SPQTY33"] = "";
                                        resultList.Rows[n - 1]["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "10":
                                        resultList.Rows[n - 1]["SPQTY37"] = "";
                                        resultList.Rows[n - 1]["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "11":
                                        resultList.Rows[n - 1]["SPQTY41"] = "";
                                        resultList.Rows[n - 1]["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "12":
                                        resultList.Rows[n - 1]["SPQTY45"] = "";
                                        resultList.Rows[n - 1]["SPQTY46"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        resultList.Rows[n - 1]["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;

                                    default:
                                        break;
                                }

                                resultList.AcceptChanges();
                            }
                            else
                            {
                                DataRow report = resultList.NewRow();
                                report["SPEntity"] = items[j - 1]["CoName"].ToString();
                                report["SPRGC"] = "";
                                switch (mo)
                                {
                                    case "1":
                                        report["SPQTY01"] = "";
                                        report["SPQTY02"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "2":
                                        report["SPQTY05"] = "";
                                        report["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "3":
                                        report["SPQTY09"] = "";
                                        report["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "4":
                                        report["SPQTY13"] = "";
                                        report["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "5":
                                        report["SPQTY17"] = "";
                                        report["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "6":
                                        report["SPQTY21"] = "";
                                        report["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "7":
                                        report["SPQTY25"] = "";
                                        report["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "8":
                                        report["SPQTY29"] = "";
                                        report["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "9":
                                        report["SPQTY33"] = "";
                                        report["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "10":
                                        report["SPQTY37"] = "";
                                        report["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "11":
                                        report["SPQTY41"] = "";
                                        report["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    case "12":
                                        report["SPQTY45"] = "";
                                        report["SPQTY46"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                        report["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                        report["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                        break;
                                    default:
                                        break;
                                }

                                resultList.Rows.Add(report);
                                resultList.AcceptChanges();
                            }
                        }
                        else
                        {
                            DataRow report = resultList.NewRow();
                            report["SPEntity"] = items[j - 1]["CoName"].ToString();
                            report["SPRGC"] = "";
                            switch (mo)
                            {
                                case "1":
                                    report["SPQTY01"] = "";
                                    report["SPQTY02"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY03"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY04"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "2":
                                    report["SPQTY05"] = "";
                                    report["SPQTY06"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY07"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY08"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "3":
                                    report["SPQTY09"] = "";
                                    report["SPQTY10"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY11"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY12"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "4":
                                    report["SPQTY13"] = "";
                                    report["SPQTY14"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY15"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY16"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "5":
                                    report["SPQTY17"] = "";
                                    report["SPQTY18"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY19"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY20"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "6":
                                    report["SPQTY21"] = "";
                                    report["SPQTY22"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY23"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY24"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "7":
                                    report["SPQTY25"] = "";
                                    report["SPQTY26"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY27"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY28"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "8":
                                    report["SPQTY29"] = "";
                                    report["SPQTY30"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY31"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY32"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "9":
                                    report["SPQTY33"] = "";
                                    report["SPQTY34"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY35"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY36"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "10":
                                    report["SPQTY37"] = "";
                                    report["SPQTY38"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY39"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY40"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "11":
                                    report["SPQTY41"] = "";
                                    report["SPQTY42"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY43"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY44"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                case "12":
                                    report["SPQTY45"] = "";
                                    report["SPQTY46"] =BusinessService.GetFieldValue(items[j - 1],"CM_IC_SI01060201");
                                    report["SPQTY47"] = Common.Utilities.GetItemValue(items[j - 1],"CM_IA_SI01060201");
                                    report["SPQTY48"] = Common.Utilities.GetItemValue(items[j - 1],"CM_BA_SI01060201");
                                    break;
                                default:
                                    break;
                            }


                            resultList.Rows.Add(report);
                            resultList.AcceptChanges();
                        }
                    }
                }
            }

            return resultList;
        }


        void BindLastMonth(string coCd, string year, string month)
        {
            string y = year;
            string m = (Convert.ToInt32(month)).ToString();
            SPListItem it = Common.BusinessService.GetItem(coCd, y, m, "Sales Interco Declaration");
            
            if (it != null)
            {
                switch (m)
                {
                    case "1":
                        #region --
                        Label_HRR01_C01.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C01.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C01.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C01.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C01.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");

                        
                        Label_HRR14_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C01.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "2":
                        #region --
                        Label_HRR01_C03.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C03.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C03.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C03.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C03.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                         
                        Label_HRR14_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C02.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "3":
                        #region --
                        Label_HRR01_C05.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C05.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C05.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C05.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C05.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        
                        Label_HRR14_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C03.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "4":
                        #region --
                        Label_HRR01_C07.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C07.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C07.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C07.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C07.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C04.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion  
                        break;
                    case "5":
                        #region --
                        Label_HRR01_C09.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C09.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C09.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C09.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C09.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C05.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "6":
                        #region --
                        Label_HRR01_C11.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C11.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C11.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C11.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C11.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C06.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "7":
                        #region --
                        Label_HRR01_C13.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C13.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C13.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C13.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C13.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C14.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C14.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C14.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C14.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C14.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C07.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "8":
                        #region --
                        Label_HRR01_C15.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C15.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C15.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C15.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C15.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C16.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C16.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C16.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C16.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C16.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C08.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "9":
                        #region --
                        Label_HRR01_C17.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C17.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C17.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C17.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C17.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C18.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C18.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C18.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C18.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C18.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C09.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "10":
                        #region --
                        Label_HRR01_C19.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C19.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C19.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C19.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C19.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C20.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C20.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C20.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C20.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C20.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C10.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "11":
                        #region --
                        Label_HRR01_C21.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C21.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C21.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C21.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C21.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C22.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C22.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C22.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C22.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C22.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C11.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;
                    case "12":
                        #region --
                        Label_HRR01_C23.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010000");
                        Label_HRR02_C23.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010100");
                        Label_HRR03_C23.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010200");
                        Label_HRR04_C23.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010201");
                        Label_HRR05_C23.Text = Utilities.GetItemValue(it, "CM_QTY_SI01010202");
                        Label_HRR01_C24.Text = Utilities.GetItemValue(it, "CM_BA_SI01010000");
                        Label_HRR02_C24.Text = Utilities.GetItemValue(it, "CM_BA_SI01010100");
                        Label_HRR03_C24.Text = Utilities.GetItemValue(it, "CM_BA_SI01010200");
                        Label_HRR04_C24.Text = Utilities.GetItemValue(it, "CM_BA_SI01010201");
                        Label_HRR05_C24.Text = Utilities.GetItemValue(it, "CM_BA_SI01010202");

                        Label_HRR06_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01030000");
                        Label_HRR07_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01030100");
                        Label_HRR08_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01030200");
                        Label_HRR09_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01030201");
                        Label_HRR10_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01030202");
                        Label_HRR11_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01040000");
                        Label_HRR12_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01040101");
                        Label_HRR13_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01040102");
                        
                        Label_HRR14_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01050000");
                        Label_HRR15_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01050101");
                        Label_HRR16_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01050200");
                        Label_HRR17_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01050201");
                        Label_HRR19_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01050202"); 
                        Label_HRR20_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01060000");
                        Label_HRR21_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01060100");
                        Label_HRR22_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01060200");
                        Label_HRR23_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01060201");
                        Label_HRR24_C12.Text = Utilities.GetItemValue(it, "CM_BA_SI01060202");
                        #endregion
                        break;

                    default:
                        break;
                }
            }
        }

    }
}
